package cn.com.b2office.dao.hibernate;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import cn.com.b2office.dao.LoadDataDao;

public class LoadDataDaoHibernateImpl extends HibernateDaoSupport implements
		LoadDataDao {

	public void loadData(Class clasz) {
		Session s = getSession();
		try {
			s.getSessionFactory().evict(clasz);
			Query query = s.createQuery("from " + clasz.getSimpleName());
			query.list();
			s.flush();
		} catch (RuntimeException e) {
			throw e;
		} finally {
			releaseSession(s);
		}

	}

}
